ELF unexec: Correct section header index
authorAlan Modra <amodra@gmail.com>
Sun, 8 Nov 2015 17:28:59 +0000 (09:28 -0800)
committerRob Browning <rlb@defaultvalue.org>
Mon, 18 Jan 2016 21:08:49 +0000 (15:08 -0600)
Emacs should build on ppc64el.  A problem with the bss has been fixed.

This upstream patch has been added [1/10]:

  ELF unexec: Correct section header index

  First a small fix.  The code incorrectly uses "NEW_SECTION_H (n)" when
  it should have been using "NEW_SECTION_H (nn)" to find the name of the
  section currently being processed.  Of course, before the bss
  sections, n and nn have the same value, so this doesn't matter except
  in the case of .sbss.  For .sbss this probably meant .bss (most likely
  the next section) was copied from memory.  A later patch removes the
  bogus .sbss handling anyway.

  * unexelf.c (unexec): Use correct index to look up names.

Origin: upstream, commit: 0bcd08ef052bca9b8d08696068c2a0c387d0dd56
Bug: http://debbugs.gnu.org/20614
Bug-Debian: http://bugs.debian.org/808347
Added-by: Rob Browning <rlb@defaultvalue.org>
src/unexelf.c

index 59e2725ba20f3fa907d0ab13f47c247a6d7014a1..d4a36f84cb1f474b07bcbbc28d104ee51337649a 100644 (file)
@@ -1016,12 +1016,12 @@ temacs:
       /* Write out the sections. .data and .data1 (and data2, called
         ".data" in the strings table) get copied from the current process
         instead of the old file.  */
-      if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+      if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".sdata")
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".lit4")
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".lit8")
          /* The conditional bit below was in Oliva's original code
             (1999-08-25) and seems to have been dropped by mistake
@@ -1044,14 +1044,14 @@ temacs:
             loader, but I never got anywhere with an SGI support call
             seeking clues.  -- fx 2002-11-29.  */
 #ifdef IRIX6_5
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".got")
 #endif
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".sdata1")
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".data1")
-         || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
+         || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
                      ".sbss"))
        src = (caddr_t) OLD_SECTION_H (n).sh_addr;
       else